package com.hxminer.hxwebs.dao;

import com.hxminer.hxwebs.model.Product;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Author YRG
 * Created by on 2018/5/15.
 * Describe
 */
@Transactional
@Repository
public interface CartDao extends PagingAndSortingRepository<Product, String> {
    //炒作数据库
    List<Product> findByUserId(String userId);

    /**
     * 根据 UserId 和 productType 判断是否该用户已经将此产品添加到购物车
     *
     * @param userId
     * @param productType
     * @return
     */
    List<Product> findByUserIdAndProductType(String userId, String productType);

}
